package com.ganzalang.gmall.designpatterns.adapter;

import lombok.extern.slf4j.Slf4j;

/**
 * @description: 不使用适配器模式
 * @author: ganzalang
 */
@Slf4j
public class WithoutAdapterPatternDemo {

    /**
     * 这时如果要迭代，使用新接口的同时又要兼容老接口的实现,就不行了
     * @param args
     */
    public static void main(String[] args) {
        OldInterface oldInterface = new OldInterfaceImpl();
        NewInterface newInterface = new NewInterfaceImpl();
        oldInterface.oldExecute();
        newInterface.newExecute();
    }

    public interface OldInterface {
        void oldExecute();
    }

    public interface NewInterface {
        void newExecute();
    }

    public static class OldInterfaceImpl implements OldInterface {

        @Override
        public void oldExecute() {
            log.info("老的方法");
        }
    }

    public static class NewInterfaceImpl implements NewInterface {

        @Override
        public void newExecute() {
            log.info("新的方法");
        }
    }
}
